package 继承作业;

public class Person {
    private String name;
    private int age;
    private String idNumber;

    public Person() {
    }

    public Person(String name, int age, String idNumber) {
        this.name = name;
        this.age = age;
        this.idNumber = idNumber;
    }

    public void eat(){
        System.out.println("人吃饭");
    }
    public void setDopt(Person person){//多态主要表现在小括号里
        person.eat();
    }//在测试时new子类，减少复写


    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 获取
     * @return idNumber
     */
    public String getIdNumber() {
        return idNumber;
    }

    /**
     * 设置
     * @param idNumber
     */
    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public String toString() {
        return "Person{name = " + name + ", age = " + age + ", idNumber = " + idNumber + "}";
    }
}
